package com.tanhua.app.controller;

import com.tanhua.app.Service.BaiduService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/baidu")
public class BaiduController {

    @Autowired
    private BaiduService baiduService;

//    上报地理信息
//    POST  /baidu/location
    @PostMapping("/location")
    public ResponseEntity updateLocation(@RequestBody Map params){
        Double longitude = Double.parseDouble(params.get("longitude").toString());
        Double latitude = Double.parseDouble(params.get("latitude").toString());
        String address = params.get("addrStr").toString();
        baiduService.updateLocation(longitude,latitude,address);
        return ResponseEntity.ok(null);
    }

}
